package org.loong.crypto.core.params;

import org.loong.crypto.core.Parameters;

/**
 * The parameters to hmac.
 */
public class HmacParameters implements Parameters {

    /**
     * The key index.
     */
    private Integer keyIndex;
    
    /**
     * The secret.
     */
    private byte[] secret;

    /**
     * no args constructor.
     */
    public HmacParameters() {}

    /**
     * builder constructor.
     *
     * @param builder builder
     */
    private HmacParameters(final Builder builder) {
        this.keyIndex = builder.keyIndex;
        this.secret = builder.secret;
    }

    /**
     * class builder.
     *
     * @return builder
     */
    public static Builder builder() {
        return new Builder();
    }

    /**
     * Gets the value of keyIndex.
     *
     * @return the value of keyIndex
     */
    public Integer getKeyIndex() {
        return keyIndex;
    }

    /**
     * Sets the keyIndex.
     *
     * @param keyIndex the keyIndex to set
     */
    public void setKeyIndex(final Integer keyIndex) {
        this.keyIndex = keyIndex;
    }
    
    /**
     * Gets the value of secret.
     *
     * @return the value of secret
     */
    public byte[] getSecret() {
        return secret;
    }

    /**
     * Sets the secret.
     *
     * @param secret the secret to set
     */
    public void setSecret(byte[] secret) {
        this.secret = secret;
    }

    /**
     * class builder.
     */
    public static final class Builder {

        private Integer keyIndex;
        
        private byte[] secret;

        /**
         * no args constructor.
         */
        private Builder() {}

        /**
         * build new Object.
         *
         * @return this
         */
        public HmacParameters build() {
            return new HmacParameters(this);
        }

        /**
         * build keyIndex.
         *
         * @param keyIndex keyIndex
         * @return this
         */
        public Builder keyIndex(final Integer keyIndex) {
            this.keyIndex = keyIndex;
            return this;
        }
        
        /**
         * build secret.
         *
         * @param secret secret
         * @return this
         */
        public Builder secret(final byte[] secret) {
            this.secret = secret;
            return this;
        }
    }
}
